home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
COMAL
/
A-COMAL Series
/
(k)aak.d64
/
comal article
< prev
next >
Wrap
Text File
|
2007-02-28
|
9KB
|
320 lines
├╧═┴╠ ┴╬─ ┘╧╒ - ╞OR ┬EGINNERS ╧NLY
BY ─AVID ╙TIDOLPH
╫╚┘ ╠┼┴╥╬ ╘╧ ╨╥╧╟╥┴═?
╘HE MANY COMMERCIAL COMPUTER PROGRAMS
AVAILABLE TODAY ARE MORE THAN
SUFFICIENT FOR MOST PEOPLE'S NEEDS.
╔F WORD PROCESSORS, SPREAD SHEETS,
AND DATA BASE MANAGERS ARE ALL YOUR
COMPUTER IS USED FOR, LEARNING TO
PROGRAM WOULD BE A WASTE OF TIME.
╞OR SOME, HOWEVER, A GOAL IS BEING
ABLE TO LEARN SOMETHING NEW...
SOMETHING THAT CAN CONTROL THAT
MYSTERIOUS BOX CALLED A COMPUTER.
╘HERE'S NOTHING LIKE THE FEELING OF
ACCOMPLISHMENT WHEN YOU TYPE IN YOUR
FIRST WORKING PROGRAM. ┴LSO,
FAMILIARITY WITH COMPUTERS AND
PROGRAMMING HELPS EASE THE SENSE OF
HELPLESSNESS MOST PEOPLE GET WHEN
DEALING WITH COMPUTERS. (╚OW DID YOU
FEEL THE FIRST TIME YOU GOT A
COMPUTERIZED BILL?) ╘HIS ARTICLE IS
FOR PEOPLE WHO HAVE MADE THE DECISION
TO NOT ONLY LEARN ABOUT COMPUTERS,
BUT TO LEARN PROGRAMMING AS WELL.
╫╚┴╘ ╔╙ ┴ ├╧═╨╒╘┼╥ ╠┴╬╟╒┴╟┼?
├OMPUTERS WORK WITH A LANGUAGE OF
ZEROS AND ONES CALLED MACHINE CODE.
╘HIS IS AS DIFFICULT TO USE AS IT
SOUNDS, AND FEW PROGRAMMERS NOW WORK
DIRECTLY IN MACHINE CODE. ╘HEY CHOOSE
INSTEAD TO USE COMPUTER "LANGUAGES".
╘HESE RANGE FROM LOW LEVEL LANGUAGES
LIKE ASSEMBLY CODE, WHERE THE WORDS
MERELY REPRESENT INDIVIDUAL MACHINE
CODE INSTRUCTIONS, TO HIGH LEVEL
LANGUAGES WHICH LOOK MORE LIKE
┼NGLISH. ├OMPARE THE FOLLOWING TWO
PROGRAMS:
┴╙╙┼═┬╠┘ ├╧─┼
-------------
* = ╙╘┴╥╘
╠─┘ #$00
╠╨ ╠─┴ ╙╘╥╔╬╟,┘
┬┼╤ ┼╬─╠╨
╩╙╥ ╧╒╘╨╒╘
╔╬┘
┬╬┼ ╠╨
┬┼╤ ┼╬─╠╨
.┬┘╘ '╘HIS IS A STRING',13,0
┼╬─╠╨ <...> ; REST OF PROGRAM CODE
├╧═┴╠
-----
╨╥╔╬╘ "╘HIS IS A STRING"
┴S YOU CAN SEE, THE STATEMENT WRITTEN
IN ├╧═┴╠ IS SHORTER AND MUCH MORE
READABLE. ┴LTHOUGH THE COMPUTER WILL
SEEM TO UNDERSTAND ├╧═┴╠ STATEMENTS
AND PROGRAMS, THE COMPUTER ITSELF
ONLY UNDERSTANDS MACHINE CODE. ├╧═┴╠,
THE LANGUAGE, IS A MACHINE CODE
PROGRAM. ╔T MUST BE LOADED INTO YOUR
COMPUTER BEFORE YOU CAN WRITE, EDIT,
OR RUN ├╧═┴╠ PROGRAMS. ╘HINK OF THE
LANGUAGE AS A TRANSLATER BETWEEN YOU
AND THE COMPUTER. ╘HIS MEANS YOU
DON'T HAVE TO LEARN MACHINE CODE -
YOU ONLY HAVE TO MAKE SURE THAT ├╧═┴╠
IS IN THE MACHINE BEFORE YOU CAN RUN
YOUR ├╧═┴╠ PROGRAMS.
╫╚┘ ╠┼┴╥╬ ├╧═┴╠?
╙INCE ┬┴╙╔├ COMES WITH MOST PERSONAL
COMPUTERS TODAY, MANY PEOPLE THINK
THAT IT IS THE BEST COMPUTER LANGUAGE
TO LEARN. ╬OT SO. ┬┴╙╔├ IS
IMPLEMENTED ON SO MANY COMPUTERS
BECAUSE IT IS THE EASIEST LANGUAGE TO
WRITE. ╔T HAS THE FEWEST COMMANDS,
AND ╬╧ DEFINITE STANDARD TO FOLLOW.
╘HIS MEANS THAT A ┬┴╙╔├ PROGRAM
WRITTEN ON ONE COMPUTER MAY ╬╧╘ RUN
ON ANOTHER COMPUTER. ┬┴╙╔├ DOES,
HOWEVER, HAVE ONE GOOD FEATURE; IT
WILL LET YOU TYPE IN A SHORT PROGRAM
AND SEE IT EXECUTE AS SOON AS YOU
TYPE THE WORD ╥╒╬. ╘EXT EDITORS OR
ELABORATE COMPILER COMMANDS ARE NOT
NECESSARY (═OST OTHER HIGH LEVEL
LANGUAGES LIKE ╨ASCAL, ╞╧╥╘╥┴╬ AND
├╧┬╧╠ REQUIRE THEM). ╘HIS MAKES ┬┴╙╔├
SEEM LIKE A EASY-TO-LEARN LANGUAGE
FOR EVERYONE.
├╧═┴╠ STARTED WITH THIS IDEA OF
INTERACTIVE WORK WITH THE PROGRAMMER,
THEN ADDED TO IT. ├╧═┴╠ HAS
STRUCTURES SUCH AS ╫╚╔╠┼, ╥┼╨┼┴╘, AND
╞╧╥ LOOPS, MULTI-LINE ╔╞-╘╚┼╬-┼╠╙┼
STATEMENTS, A ├┴╙┼ STATEMENT
(SIMILIAR TO A MULTIPLE CHOICE
QUESTION), AND NAMED ╨╥╧├EDURES AND
╞╒╬├TIONS COMPLETE WITH PARAMETERS.
╘HESE STRUCTURES ARE SIMILIAR THOSE
IN "PROFESSIONAL" LANGUAGES LIKE
╨ASCAL. ├╧═┴╠ ALSO HAS THE TURTLE
GRAPHICS MADE FAMOUS BY ╠OGO. ├╧═┴╠
IS NOW THE LANGUAGE TAUGHT IN THE
SCHOOLS OF 5 ┼UROPEAN COUNTRIES.
├╧═┴╠ IS EASIER TO LEARN THAN ┬┴╙╔├,
AND TEACHES THE IDEA OF STRUCTURED
PROGRAMING NECESSARY WITH MODERN
COMPUTER LANGUAGES.
╚╧╫ ─╧ ╔ ╟┼╘ ├╧═┴╠?
├ONGRATULATIONS, ├╧═┴╠ IS INCLUDED ON
THIS DISK. ╘O USE ├╧═┴╠, FOLLOW THESE
STEPS:
1. ╘YPE ╠╧┴─ ":*",8
╘YPE ╥╒╬
2. ╘HIS WILL GIVE YOU ├╧═┴╠'S
INTRODUCTORY SCREEN. ┘OU WILL BE
GIVEN SOME ├╧═┴╠ INFORMATION AND
THE CURSOR WILL BE LEFT ON BOTTOM
OF THE SCREEN OVER THE WORDS:
CHAIN"MENU"
3. ╨RESS ╥┼╘╒╥╬
4. ┴FTER A SHORT WAIT, YOU WILL BE
PUT IN A ├╧═┴╠ PROGRAM DISPLAYING
ANOTHER MENU. ╘HIS WILL ALLOW YOU
TO RUN THE ├╧═┴╠ PROGRAMS ON THIS
DISK, OR TO READ ARTICLES SUCH AS
THE ONE YOU ARE READING NOW. ╔F
YOU WANT TO ENTER THE ├╧═┴╠ EDITOR
TO WRITE YOUR OWN PROGRAMS, SIMPLY
ENTER THE "╤╒╔╘ ╘╚╔╙ ═┼╬╒" OPTION.
5. ╔F YOU ARE ALREADY IN ├╧═┴╠, BUT
WANT TO RE-ENTER THE MENU FROM
STEP 3, ALL YOU NEED TO DO IS TYPE
IN:
├╚┴╔╬ "MENU"
ASSUMING THE ├╧═┴╠ DISK IS IN THE
DISK DRIVE.
╬╧╘┼: ├╧═┴╠ AND THE ├╧═┴╠ PROGRAMS ON
THIS DISK ARE COPYRIGHTED, BUT WE
GIVE YOU PERMISSION TO GIVE COPIES
AWAY.
╫╚┴╘ ─╧ ╔ ─╧ ╫╔╘╚ ├╧═┴╠?
╙INCE ├╧═┴╠ IS ON THIS DISK, YOU CAN
LEARN TO WRITE READABLE PROGRAMS.
╧NE WAY TO LEARN IS TO FIRST LOOK AT
OTHER PEOPLES' WORK. ╔ WILL DETAIL
CERTAIN COMMANDS NOW SO THAT YOU CAN
DO JUST THAT. ╘HE COMMANDS WILL BE
LISTED IN ╒╨╨┼╥├┴╙┼, BUT TYPE THEM IN
WITH UNSHIFTED LETTERS.
├┴╘
╘HIS COMMAND WILL SHOW YOU WHAT FILES
ARE ON THE DISK IN THE DISK DRIVE.
╘HE DISK DRIVE SENDS THE DISK
─╔╥┼├╘╧╥┘ TO THE COMPUTER, AND ├╧═┴╠
PRINTS IT ON THE SCREEN. ╘HE ACTUAL
LISTING SHOWS MORE THAN JUST FILE
NAMES. ╔T SHOWS HOW BIG THEY ARE,
THEIR NAMES, AND THE FILE TYPE. ┼ACH
ENTRY IN THE DIRECTORY IS CALLED A
FILE, AND THERE ARE FOUR TYPES OF
FILES - ╨╥╟ (PROGRAM), ╙┼╤
(SEQUENTIAL - DATA FILES), ╥┼╠
(RANDOM - ALSO DATA FILES), AND ╒╙╥
(SPECIAL FILES). ╒NLIKE THE ┬┴╙╔├
COMMANDS:
╠╧┴─ "$",8
╠╔╙╘
├╧═┴╠ WILL NOT ERASE THE PROGRAM IN
MEMORY WHILE SHOWING A DIRECTORY OF A
DISK. ┘OU CAN SLOW THE SCROLLING
LINES BY HOLDING DOWN THE ├╘╥╠ KEY ON
THE UPPER LEFT HAND SIDE OF THE
KEYBOARD, OR STOP IT BY PRESSING THE
╥╒╬/╙╘╧╨ KEY (RIGHT BELOW THE ├╘╥╠
KEY). ╔F YOU HAPPEN TO HAVE A DUAL
DRIVE (A TWO DRIVE UNIT) YOU CAN ADD
A '0' OR A '1' AFTER THE COMMAND:
CAT 0 (╘HIS IS FOR DRIVE 0)
CAT 1 (╘HIS IS FOR DRIVE 1)
╠╧┴─
╧NCE YOU KNOW WHAT IS ON A DISK, YOU
CAN LOAD ├╧═┴╠ PROGRAMS INTO MEMORY
WITH THIS COMMAND. ╔T IS SIMILAR TO
THE ┬┴╙╔├ ╠╧┴─ COMMAND, EXCEPT YOU NO
LONGER NEED TO TYPE THE COMMA 8. ╘HE
FOLLOWING IS AN EXAMPLE OF LOADING A
PROGRAM CALLED "FILENAME" FROM THE
DISK DRIVE:
LOAD "FILENAME"
╧NLY ╨╥╟ TYPE FILES CAN BE LOADED. ┬E
CAREFUL, BECAUSE OTHER LANGUAGES,
LIKE ┬┴╙╔├, ALSO STORE THEIR PROGRAMS
AS ╨╥╟ FILES. ├╧═┴╠ 0.14 WILL ATTEMPT
TO LOAD ANY ╨╥╟ TYPE FILE YOU ASK IT
TO. ╔F YOU ARE NOT SURE WHETHER OR
NOT A PROGRAM WAS WRITTEN IN ├╧═┴╠
0.14, LOAD THE PROGRAM AND ╠╔╙╘ IT.
╧NLY ├╧═┴╠ 0.14 PROGRAMS CAN BE
LISTED, ANY OTHER TYPE OF PROGRAM
(┬┴╙╔├, ├╧═┴╠ 2.0, ETC) WILL NOT
LIST. ─╧ ╬╧╘ ╥╒╬ ╨╥╧╟╥┴═╙ ╫╚╔├╚ ╫╧╬'╘
╠╔╙╘. ╔F YOU DO, ├╧═┴╠ WILL BECOME
CONFUSED AND STOP FUNCTIONING. ╘HE
ONLY THING TO DO AFTER THIS HAS
HAPPENED IS TO TURN THE COMPUTER OFF
AND RELOAD ├╧═┴╠.
╠╔╙╘
╧NCE A ├╧═┴╠ PROGRAM IS IN MEMORY,
YOU WILL WANT TO BE ABLE TO SEE IT.
╘HE COMMAND ╠╔╙╘ WILL DO JUST THAT,
IT WILL LIST THE PROGRAM TO THE
SCREEN. ╘HE FIRST THING YOU WILL
NOTICE IS YOU WILL WANT TO SLOW OR
STOP THE LISTING (SO YOU CAN STUDY
IT). ╩UST AS WITH THE CATALOG
COMMAND, YOU CAN USE THE ├╘╥╠ KEY TO
SLOW THE LISTING, OR THE ╥╒╬/╙╘╧╨ KEY
TO STOP THE LISTING. ╫HEN ╠╔╙╘ING A
╨╥╧╟╥┴═, THE SPACE BAR WILL PAUSE THE
LISTING.
┘OU WILL NOTICE THAT EACH LINE HAS A
NUMBER IN FRONT OF IT. ├╧═┴╠ USES
THEM TO KEEP TRACK OF THE ORDER OF
THE PROGRAM LINES. ╘HE ORDER GOES
FROM LOW (1) TO HIGH (9999). ┘OU CAN
USE ANY LINE NUMBER BETWEEN.
╘HE ╠╔╙╘ COMMAND CAN ALSO BE USED TO
SHOW JUST PART OF A PROGRAM. ╘HE
FOLLOWING ARE SOME EXAMPLES TO DO
JUST THAT:
LIST (ALL LINES)
LIST 100-500 (FROM LINE 100 TO 500)
LIST 100- (FROM LINE 100 TO END)
LIST -500 (FROM BEGINNING TO 500)
╥╒╬
╫HEN THE PROGRAM YOU WANT HAS BEEN
LOADED INTO MEMORY, YOU START THE
PROGRAM WITH THE COMMAND ╥╒╬. ╘HE
COMPUTER DOES A QUICK SCAN OF THE
PROGRAM TO MAKE SURE IT SEEMS
CORRECT, AND STARTS EXECUTING WITH
THE FIRST LINE OF THE PROGRAM. ╔F AN
ERROR OCCURS WHILE THE PROGRAM IS
RUNNING, THE PROGRAM WILL STOP
EXECUTING. ├╧═┴╠ WILL PRINT WHAT THE
PROBLEM IS AND THE LINE NUMBER IT
OCCURED ON.
═┴╦╔╬╟ ┼╥╥╧╥╙
╘HERE IS A VERY GOOD CHANCE THAT YOU
WILL MAKE TYPING ERRORS WHILE TRYING
THESE COMMANDS. ├╧═┴╠ CHECKS EACH
LINE YOU TYPE FOR ERRORS, AND IF IT
CANNOT UNDERSTAND WHAT YOU TYPED, IT
WILL STOP AND GIVE YOU AN ERROR
MESSAGE. ╔T MIGHT GO OUT TO THE DISK
DRIVE AND GET THE ERROR MESSAGE, OR
IT MIGHT JUST PRINT THE MESSAGE
ITSELF (THAT DEPENDS ON YOUR CHOICE
TO HAVE ERROR MESSAGES IN MEMORY OR
NOT). ╔F YOU GET AN ERROR, ├╧═┴╠ WILL
PUT THE CURSOR ON THE PART OF THE
LINE IT IS HAVING TROUBLE WITH SO
─╧╬'╘ ╨┴╬╔├. ╩UST MAKE THE CORRECTION
AND PRESS THE ╥┼╘╒╥╬ KEY AGAIN.
╙╘┴╘╒╙
╔F THE RED LIGHT ON THE DISK DRIVE
STARTS BLINKING ON AND OFF WHILE
├╧═┴╠ JUST SITS THERE WAITING FOR YOU
TO TYPE SOMETHING, TRY TYPING IN THE
╙╘┴╘╒╙ COMMAND. ╘HIS WILL PRINT DISK
ERROR MESSAGE TO THE SCREEN. ├HECK
YOUR DISK DRIVE MANUAL FOR MORE
INFORMATION IF NECESSARY.